<template>
  <div class="body">
    <!-- 标题 -->
    <v-head></v-head>
    <!-- 国标公告 -->
    <Row class="restand">
        <i-col class="standkepudigndan" span="17">
        <div class="standardt">
            国家标准公告
        </div>
        <div class="result">
            <Row class="orderrow" v-for="(item,index) in results" :key="index">
            <i-col span="1">
                <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
                <span @click="getDetail(item.id)" class="itemtitle">{{item.title}}</span>
            </i-col>
            <i-col span="2">
                <div  class="itemtitledate">{{item.createDate.substring(0,10)}}</div>
            </i-col>
            </Row>
            <Page :total="dataCount" :page-size="pageSize" show-total @on-change="changepage" v-if="showPage" class-name="changepage" show-elevator />
        </div>
        </i-col>
    </Row>
    <!-- 地标公告 -->
    <Row class="restand">
        <i-col class="standkepudigndan" span="17">
        <div class="standardt">
            地方标准公告
        </div>
        <div class="result">
            <Row class="orderrow" v-for="(item,index) in dresults" :key="index">
            <i-col span="1">
                <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
                <span @click="getDetail(item.id)" class="itemtitle">{{item.title}}</span>
            </i-col>
            <i-col span="2">
                <div  class="itemtitledate">{{item.createDate.substring(0,10)}}</div>
            </i-col>
            </Row>
            <Page :total="ddataCount" :page-size="dpageSize" show-total @on-change="changepaged" v-if="dshowPage" class-name="changepage" show-elevator />
        </div>
        </i-col>
    </Row>
    <!-- 行标公告 -->
    <Row class="restand">
        <i-col class="standkepudigndan" span="17">
        <div class="standardt">
            行业标准公告
        </div>
        <div class="result">
            <Row class="orderrow" v-for="(item,index) in hresults" :key="index">
            <i-col span="1">
                <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
                <span @click="getDetail(item.id)" class="itemtitle">{{item.title}}</span>
            </i-col>
            <i-col span="2">
                <div  class="itemtitledate">{{item.createDate.substring(0,10)}}</div>
            </i-col>
            </Row>
            <Page :total="hdataCount" :page-size="hpageSize" show-total @on-change="changepageh" v-if="hshowPage" class-name="changepage" show-elevator />
        </div>
        </i-col>
    </Row>
    <!-- 底部 -->
    <v-foot></v-foot>
    <Back-top></Back-top>
  </div>
</template>
<script>
import {neturl} from '../assets/js/common'
export default {
  name: 'seniorsearch',
  data () {
    return {
      dataCount: 0,
      pageSize: 10,
      pageNum: 1,
      showPage: false,
      results: [],
      hdataCount: 0,
      hpageSize: 10,
      hpageNum: 1,
      hshowPage: false,
      hresults: [],
      ddataCount: 0,
      dpageSize: 10,
      dpageNum: 1,
      dshowPage: false,
      dresults: []
    }
  },
  methods: {
    // 获取国标公告
    getNewlist () {
      let uploadcc = { data: '{page: ' + this.pageNum + ', pagesize: ' + this.pageSize + ', cateid:"402881fb56a21c8f0157089d14970002"}' }
      this.$axios.post(neturl + '/by/news/getlist', uploadcc
      ).then(res => {
        // console.log(res)
        this.results = res.data.data.result
        this.dataCount = res.data.data.records
        this.showPage = true
        this.$Spin.hide()
      })
    },
    // 获取地标公告
    getDNoticelist () {
      let uploadcc = { data: '{page: ' + this.dpageNum + ', pagesize: ' + this.dpageSize + ', cateid:"402881fb56a21c8f0157089d70160003"}' }
      this.$axios.post(neturl + '/by/news/getlist', uploadcc
      ).then(res => {
        // console.log(res)
        this.dresults = res.data.data.result
        this.ddataCount = res.data.data.records
        this.dshowPage = true
        this.$Spin.hide()
      })
    },
    // 获取行标公告
    getHNoticelist () {
      let uploadcc = { data: '{page: ' + this.hpageNum + ', pagesize: ' + this.hpageSize + ', cateid:"402881fb56a21c8f0157089dca8d0004"}' }
      this.$axios.post(neturl + '/by/news/getlist', uploadcc
      ).then(res => {
        // console.log(res)
        this.hresults = res.data.data.result
        this.hdataCount = res.data.data.records
        this.hshowPage = true
        this.$Spin.hide()
      })
    },
    logout () {
      this.$cookie.delete('user')
      let routeUrl = this.$router.resolve({
        path: '/'
      })
      window.open(routeUrl.href)
    },
    changepage (value) {
      this.pageNum = value
      this.getNewlist()
    },
    changepaged (value) {
      // console.log(value)
      this.dpageNum = value
      this.getDNoticelist()
    },
    changepageh (value) {
      this.hpageNum = value
      this.getHNoticelist()
    },
    getDetail (id) {
      // console.log(id)
      let routeData = this.$router.resolve({path: '/noticeitem', query: {id: id}})
      window.open(routeData.href, '_blank')
    }
  },
  created () {
    this.$Spin.show()
    // this.model1 = this.cityList[0].value
    this.userinfo = this.$cookie.get('user')
    this.userinfo = JSON.parse(this.userinfo)
    // 已登录
    if (this.userinfo != null) {
      this.islogin = true
      this.islog = false
      this.username = this.userinfo.realName
    }
    this.getNewlist()
    this.getDNoticelist()
    this.getHNoticelist()
  }
}
</script>

<style scoped>
  @import '../assets/css/newlist.css';
</style>
